// 步骤条数据
export const stepsOption = [
  { id: 0, label: '订单主信息' },
  { id: 1, label: '订单明细' },
  { id: 2, label: '付款节点' },
  { id: 3, label: '订单附件' },
  { id: 4, label: '订单正文' },
];
// 主信息表单
export const mainForm = [
  { span: 8, type: 'other', labelText: '密级', fieldName: 'secretLevel' },
  {
    span: 8,
    type: 'text',
    labelText: '订单号',
    fieldName: 'sysOrderNo',
    disabled: true,
    placeholder: '后端生成',
  },
  { span: 8, type: 'other', labelText: '合同号', fieldName: 'orderNo' },
  {
    span: 8,
    type: 'dict',
    labelText: '订单类型',
    fieldName: 'orderType',
    dictType: 'orderType',
  },
  {
    span: 8,
    type: 'other',
    labelText: '供应商编码',
    fieldName: 'mdsVendorCode',
  },
  {
    span: 8,
    type: 'text',
    labelText: '供应商名称',
    disabled: true,
    fieldName: 'mdsVendorName',
  },
  {
    span: 8,
    type: 'other',
    labelText: '供应商联系人',
    fieldName: 'vendorLinkManName',
  },
  {
    span: 8,
    type: 'text',
    labelText: '供应商联系人电话',
    disabled: true,
    fieldName: 'vendorLinkPhoneNo',
  },
  {
    span: 8,
    type: 'text',
    labelText: '供应商联系人传真',
    disabled: true,
    fieldName: 'vendorLinkFaxNo',
  },
  {
    span: 8,
    type: 'other',
    labelText: '机型',
    fieldName: 'proMdsItemName',
  },
  {
    span: 8,
    type: 'other',
    labelText: '订单模板',
    fieldName: 'mdsTempletName',
  },
  {
    span: 8,
    type: 'dict',
    labelText: '国内/外采购',
    fieldName: 'abroadFlag',
    dictType: 'abroadFlag',
  },
  {
    span: 8,
    type: 'dict',
    labelText: '币种',
    fieldName: 'currencyType',
    dictType: 'currencyType',
  },
  {
    span: 8,
    type: 'other',
    labelText: '合同类型',
    fieldName: 'contractCategoDisplay',
  },
  {
    span: 8,
    type: 'text',
    labelText: '一级采购品类',
    disabled: true,
    fieldName: 'mdsCatagoryLv1Name',
  },
  { span: 8, type: 'text', labelText: '联系人电话', fieldName: 'linkPhoneNo' },
  { span: 8, type: 'text', labelText: '联系人传真', fieldName: 'linkFaxNo' },
  { span: 8, type: 'text', labelText: '交货地址', fieldName: 'deliverToPlace' },
  {
    span: 8,
    type: 'text',
    labelText: '指定收货人和联系人电话',
    fieldName: 'deliverToLinkInfo',
  },
  {
    span: 8,
    type: 'text',
    labelText: '编制人',
    disabled: true,
    fieldName: 'editUserName',
  },
  {
    span: 8,
    type: 'text',
    labelText: '编制人部门',
    disabled: true,
    fieldName: 'editDeptName',
  },
  {
    span: 8,
    type: 'date',
    labelText: '编制日期',
    disabled: true,
    fieldName: 'editDateTime',
    showTime: false,
    valueFormat: 'YYYY-MM-DD',
    format: 'YYYY-MM-DD',
  },
  { span: 8, type: 'other', labelText: '任务编号', fieldName: 'missionNo' },
  {
    span: 8,
    type: 'date',
    labelText: '生效起始日期',
    fieldName: 'effectiveBegDateTime',
    showTime: false,
    valueFormat: 'YYYY-MM-DD',
    format: 'YYYY-MM-DD',
  },
  {
    span: 8,
    type: 'date',
    labelText: '生效截止日期',
    fieldName: 'effectiveEndDateTime',
    showTime: false,
    valueFormat: 'YYYY-MM-DD',
    format: 'YYYY-MM-DD',
  },
  {
    span: 24,
    type: 'text',
    autoSize: true,
    labelText: '备注',
    fieldName: 'note',
  },
];
// 主信息表单项校验
export const mainFormRules = (form: any) => {
  return {
    secretLevel: [{ required: true, message: '请选择' }],
    orderNo: [{ required: true, message: '请选择' }],
    orderType: [{ required: true, message: '请选择' }],
    mdsTempletName: [{ required: true, message: '请选择' }],
    currencyType: [{ required: true, message: '请选择' }],
    missionNo: [{ required: true, message: '请选择' }],
    contractCategoDisplay: [{ required: true, message: '请选择' }],
    effectiveBegDateTime: [
      { required: false, message: '请选择' },
      {
        validator: (value: any, cb: (arg0?: string | undefined) => void) => {
          console.log('form.effectiveEndDateTime', form.effectiveEndDateTime);
          if (!form.effectiveEndDateTime) {
            cb();
          }
          if (value > form.effectiveEndDateTime) {
            cb('生效起始日期不能晚于生效截止日期！');
          } else {
            cb();
          }
        },
      },
    ],
    effectiveEndDateTime: [
      { required: false, message: '请选择' },
      {
        validator: (value: any, cb: (arg0?: string | undefined) => void) => {
          if (!form.effectiveBegDateTime) {
            cb();
          }
          if (value < form.effectiveBegDateTime) {
            cb('生效截止日期不能早于生效起始日期！');
          } else {
            cb();
          }
        },
      },
    ],
  };
};

// form共通信息
export const commonFormData = [
  { label: '密级', code: 'secretLevel' },
  { label: '订单号', code: 'sysOrderNo' },
  { label: '合同号', code: 'orderNo' },
  { label: '开口订单标识', code: 'openFlag' },
  { label: '订单类型', code: 'orderType' },
  { label: '供应商', code: 'mdsVendorName' },
  { label: '国内/外采购', code: 'abroadFlag' },
  { label: '订单不含税金额', code: 'contractValue' },
  { label: '不含税大写金额', code: 'contractValueWord' },
  { label: '交货地址', code: 'deliverToPlace' },
  { label: '订单含税总额', code: 'taxContractValue' },
  { label: '含税大写金额', code: 'taxContractValueWord' },
  { label: '指定收货人和联系人电话', code: 'deliverToLinkInfo' },
  { label: '订单总税额', code: 'taxContractValueSum' },
  { label: '总税额大写金额', code: 'taxContractSum' },
];

// 明细列表
export const detailTableCols = [
  {
    title: '密级',
    dataIndex: 'secretLevel',
    componentName: 'secretLevel',
    tooltip: true,
    ellipsis: true,
    width: 100,
  },
  {
    title: '商务合同编号',
    dataIndex: 'orderNo',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '序号',
    dataIndex: 'serialNo',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '物料编码',
    dataIndex: 'mdsItemCode',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '物料名称',
    dataIndex: 'mdsItemName',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '牌号',
    dataIndex: 'marque',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '规格',
    dataIndex: 'specs',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '技术条件',
    dataIndex: 'techCondition',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '交货状态',
    dataIndex: 'deliveryStatus',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '产品（机型）',
    dataIndex: 'proMdsItemName',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '批次',
    dataIndex: 'batchLotNo',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '架次',
    dataIndex: 'manufactureLotno',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '图号',
    dataIndex: 'drawingCode',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '图号名称',
    dataIndex: 'productItemName',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '成品型号',
    dataIndex: 'marque',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '父型号',
    dataIndex: 'parentModelNo',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '技术协议/标准',
    dataIndex: 'agreeementCode',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '研制状态',
    dataIndex: 'developmentStatus',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '单机数量',
    dataIndex: 'qtySingleMachine',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '加工内容',
    dataIndex: 'machiningContent',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '可签订数量（库存）',
    dataIndex: 'invSureOrdQty',
    tooltip: true,
    ellipsis: true,
    width: 180,
  },
  {
    title: '已签订单数（库存）',
    dataIndex: 'invOrdQty',
    tooltip: true,
    ellipsis: true,
    width: 180,
  },
  {
    title: '基本计量单位',
    dataIndex: 'invMdsUnitDesc',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '不含税单价（库存）',
    dataIndex: 'invUnitPrice',
    tooltip: true,
    ellipsis: true,
    width: 180,
  },
  {
    title: '转换系数',
    dataIndex: 'mdsUnitRate',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '可签订数量（采购）',
    dataIndex: 'pmsSureOrdQty',
    tooltip: true,
    ellipsis: true,
    width: 180,
  },
  {
    title: '已签订单数（采购）',
    dataIndex: 'pmsOrdQty',
    tooltip: true,
    ellipsis: true,
    width: 180,
  },
  {
    title: '计量单位（采购）',
    dataIndex: 'pmsMdsUnitDesc',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '不含税单价（采购）',
    dataIndex: 'pmsUnitPrice',
    tooltip: true,
    ellipsis: true,
    width: 180,
  },
  {
    title: '不含税金额',
    dataIndex: 'totalAmount',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '税率（%）',
    dataIndex: 'taxRate',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '含税单价',
    dataIndex: 'taxPrice',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '含税金额',
    dataIndex: 'taxMoney',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '单件税额',
    dataIndex: 'ratePrice',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '总税额',
    dataIndex: 'sumRate',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '结算单价',
    dataIndex: 'settlementPrice',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '含税结算单价',
    dataIndex: 'settlementTaxPrice',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '预估价',
    dataIndex: 'pmsPredictPrice',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '交货时间',
    dataIndex: 'planArrivalDateTime',
    tooltip: true,
    ellipsis: true,
    width: 250,
  },
  {
    title: '交货地址',
    dataIndex: 'deliverToPlace',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '指定收货人和联系人电话',
    dataIndex: 'deliverToLinkInfo',
    tooltip: true,
    ellipsis: true,
    width: 190,
  },
  {
    title: '交付公差（%）',
    dataIndex: 'deliverOverproofRate',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '生产商',
    dataIndex: 'manufacturerName',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '备注',
    dataIndex: 'notes',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '是否采购',
    dataIndex: 'isPurchase',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '材料尺寸',
    dataIndex: 'mdsItemSize',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '转码机型',
    dataIndex: 'dlvrtDkAftModls',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
  {
    title: '转码图号',
    dataIndex: 'dlvrtDkAftDrwno',
    tooltip: true,
    ellipsis: true,
    width: 150,
  },
];
// 付款节点列表
export const payNodeTableRenderKeys = [
  { title: '密级', dataIndex: 'secretLevel' },
  { title: '节点类型', dataIndex: 'orderName224' },
  { title: '进度日期', dataIndex: 'orderName225' },
  { title: '付款比例（%）', dataIndex: 'orderName226' },
  { title: '结算方式', dataIndex: 'orderName227' },
];
interface Tst {
  [index: string]: any;
}
// 添加订单明细时用
export const addDetailRenderKeys = <Tst>{
  formRenderKeys: [
    'planListNo',
    'contractCode',
    'supplierName',
    'orderName113',
    'materialCode',
    'planArrivalDate',
  ],
  // 列表-成品
  '2': [
    'secretLevel',
    'planListNo',
    'supplierCode',
    'supplierName',
    'materialCode',
    'materialName',
    'brandNo',
    'specification',
    'technicalCondition',
    'machineNo',
    'batchNo',
    'manufactureLotNo',
    'transcodePicNo',
    'orderName125',
    'orderName126',
    'orderName127',
    'orderName128',
    'orderName129',
    'orderName130',
    'orderName131',
    'orderName132',
    'orderName133',
    'orderName134',
    'taxRate',
    'taxPrice',
    'pmsBalancePrice',
    'pmsInvtaxPrice',
    'orderName139',
    'planArrivalDate',
    'purchaseContractOn',
    'orderName141',
    'requireSourceType',
    'note',
  ],
  // 列表-原材料
  '3': [
    'secretLevel',
    'planListNo',
    'supplierCode',
    'supplierName',
    'materialCode',
    'materialName',
    'brandNo',
    'specification',
    'technicalCondition',
    'machineNo',
    'batchNo',
    'manufactureLotNo',
    'transcodePicNo',
    'orderName125',
    'substanceSize',
    'orderName126',
    'orderName127',
    'orderName128',
    'orderName129',
    'orderName130',
    'orderName131',
    'orderName132',
    'orderName133',
    'orderName134',
    'taxRate',
    'taxPrice',
    'orderName139',
    'planArrivalDate',
    'purchaseContractOn',
    'orderName141',
    'requireSourceType',
    'orderName145',
    'note',
  ],
  // 列表-标准件
  '1': [
    'secretLevel',
    'planListNo',
    'supplierCode',
    'supplierName',
    'materialCode',
    'materialName',
    'brandNo',
    'specification',
    'technicalCondition',
    'machineNo',
    'batchNo',
    'manufactureLotNo',
    'transcodePicNo',
    'orderName125',
    'orderName126',
    'orderName127',
    'orderName128',
    'orderName129',
    'orderName130',
    'orderName131',
    'orderName132',
    'orderName133',
    'orderName134',
    'taxRate',
    'taxPrice',
    'orderName139',
    'planArrivalDate',
    'purchaseContractOn',
    'orderName141',
    'requireSourceType',
    'note',
  ],
  // 列表-零组件
  '4': [
    'secretLevel',
    'planListNo',
    'supplierCode',
    'supplierName',
    'orderName146',
    'orderName147',
    'orderName148',
    'materialCode',
    'orderName149',
    'orderName150',
    'machineContent',
    'batchNo',
    'manufactureLotNo',
    'brandNo',
    'specification',
    'technicalCondition',
    'machineNo',
    'orderName125',
    'orderName126',
    'orderName127',
    'orderName128',
    'orderName129',
    'orderName130',
    'orderName131',
    'orderName132',
    'orderName133',
    'orderName134',
    'taxRate',
    'taxPrice',
    'orderName139',
    'planArrivalDate',
    'purchaseContractOn',
    'orderName141',
    'requireSourceType',
    'note',
    'orderName152',
  ],
  // 列表-锻铸件
  '5': [
    'secretLevel',
    'planListNo',
    'supplierCode',
    'supplierName',
    'materialCode',
    'materialName',
    'brandNo',
    'specification',
    'technicalCondition',
    'machineNo',
    'batchNo',
    'manufactureLotNo',
    'transcodePicNo',
    'orderName125',
    'substanceSize',
    'orderName126',
    'orderName127',
    'orderName128',
    'orderName129',
    'orderName130',
    'orderName131',
    'orderName132',
    'orderName133',
    'orderName134',
    'taxRate',
    'taxPrice',
    'orderName139',
    'planArrivalDate',
    'purchaseContractOn',
    'orderName141',
    'requireSourceType',
    'note',
    'orderName152',
  ],
};
// 订单字段和合同字段映射关系
export const itemReflection = <Tst>{
  supplierChoseResultId: 'purchaseMerchantResultId',
  pmsLongtermAgreementLId: 'id',
  mdsItemCode: 'mdsItemCode',
  proMdsItemId: 'tempName4',
  proMdsItemCode: 'machineNo',
  machiningContentCode: 'machineContentNo',
  machiningContent: 'machineContent',
  invOrdQty: 'tempName8',
  invUnitPrice: 'tempName9',
  mdsUnitRate: 'mdsUintRate',
  pmsOrdQty: 'tempName11',
  pmsUnitPrice: 'tempName12',
  totalAmount: 'tempName13',
  taxRate: 'taxRate',
  taxPrice: 'taxPrice',
  taxMoney: 'totalAmountIncludingTax',
  ratePrice: 'unitTax',
  sumRate: 'totalTaxAmount',
  settlementTaxPrice: 'pmsInvtaxPrice',
  deliverOverproofRate: 'tempName20',
  totalAssessmentTaxAmount: 'tempName21',
  totalAccountTaxAmount: 'tempName22',
  pmsDeliverNodeSourceType: 'tempName23',
  planDeliveryQty: 'tempName24',
  planSourceType: 'requireSourceType',
  agreeementCode: 'technicalAgreement',
  workRoute: 'tempName27',
  apsNote: 'tempName28',
  qualifiedQty: 'tempName29',
  overdueNum: 'tempName30',
  batchOperationExecute: 'tempName31',
  operationDeliveryDateTime: 'tempName32',
  letterScheduling: 'tempName33',
  projectScheduling: 'tempName34',
  experimentScheduling: 'tempName35',
  warehousingScheduling: 'tempName36',
  prepareFeedExecute: 'tempName37',
  alocLt: 'aloclt',
  prepareFeedStarus: 'tempName39',
  currentScheduling: 'tempName40',
  letterQty: 'approvalLetterCount',
  priceType: 'inputType',
  pmsPlanOrderDetailNum: 'planListNo',
  batchLotNo: 'batchNo',
  manufactureLotno: 'batchFlow',
  cpParentModelCode: 'productSuperTypeNo',
  planArrivalDateTime: 'planArrivalDate',
  mdsVendorName: 'supplierName',
  marque: 'brandNo',
  mdsVendorCode: 'supplierCode',
  dlvrtDkAftModls: 'transcodeMachineNo',
  dlvrtDkAftDrwno: 'transcodePicNo',
};
